<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
</head>
<body>
    <div>我是div</div>
    <span>我是span</span>
    <script>
        var div = document.querySelector('div');
        //nextSilbling 下一个兄弟节点 包含元素节点或者文本节点等等
        console.log(div.nextSibling);
        console.log(div.previousSibling);
        //2.nextElementSibling 下一个兄弟元素节点
        console.log(div.nextElementSibling);
        console.log(div.previousElementSibling);

        console.log(getNextElememtSibling(div));
        
        function getNextElememtSibling(element) {
            var el = element;
            while (el = el.nextSibling){
                if (el.nodeType == 1){
                    return el;
                }
            }
            return null;
        }
    </script>
</body>
</html>